<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta
			name="viewport"
			content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no"
		/>
		<meta name="format-detection" content="telephone=no" />
		<meta name="format-detection" content="email=no" />
		<meta http-equiv="Pragma" content="no-cache" />
		<meta http-equiv="Cache-Control" content="no-cache" />
		<meta http-equiv="Expires" content="0" />
		<title>数治科技</title>
		<!-- 引入 vant UI 组件库样式文件 -->
		<link rel="stylesheet" href="../common/css/vant-index.css" />
	</head>

	<body>
		<div id="app" v-cloak></div>
	</body>
	<!-- 引入 rem -->
	<script src="../common/js/rem.js"></script>
	<!-- 上线环境用 -->
	<script src="../common/js/vue.global.prod.js"></script>
	<!-- 引入 UI 组件库 -->
	<script src="../common/js/vant.min.js"></script>
	<!-- axios 接口调用 -->
	<script src="../common/js/axios.min.js"></script>
	<script src="../base.js"></script>
	<script src="../common/js/url.min.js"></script>
	<script src="../common/js/swiper.min.js"></script>

	<script type="module">
		// var vConsole = new VConsole()
		import {
			getAction,
			postAction,
			spliceUrl,
			getUrl,
		} from '../common/js/api/vue3-axios-utils.js'

		const el = {
			data() {
				return {
					
				}
			},
			created() {
				this.$toast.loading({
					duration: 0,
					message: '加载中...',
					forbidClick: true,
				})
				this.handleQrcode()
			},
			methods: {
				handleQrcode(code, router) {
					let content = url('?content')
					if(content) {
						let contentArr = content.split('|')
						if (contentArr[1] == undefined) {
							contentArr = content.split('%7C')
						}

						if (contentArr[0] == '' || contentArr[1] == '') {
							this.$toast.fail({
								duration: 0,
								message: '数据异常',
							})
						}

						postAction(spliceUrl('/shop/order/qrcode'), {
							type: contentArr[0] ,
							id: contentArr[1],
						}).then(res => {
							res = res.data
							console.log(res)
							if (res.success) {
								
								sessionStorage.setItem('products', JSON.stringify(res.data.products))
								sessionStorage.setItem('usePrice', JSON.stringify(res.data.use_price))
								window.location.href = './confirm.html?pid=' + res.data.patient_id

							} else {
								let message = '数据处理失败'
								this.$toast.clear()
								this.$toast.fail({
									duration: 0,
									message,
								})
							}
						})
					} else {
						this.$toast.fail({
							duration: 0,
							message: '数据异常',
						})
					}
				},
			},
		}

		const app = Vue.createApp(el)

		app.use(vant)

		// 通过 CDN 引入时不会自动注册 Lazyload 组件
		// 可以通过下面的方式手动注册
		app.use(vant.Lazyload)

		// 调用函数组件，弹出一个 Toast
		// vant.Toast("刷新成功");

		app.mount('#app')
	</script>
</html>
